home *** CD-ROM | disk | FTP | other *** search
- /* Tidies up after sMOVIE
- Martin J. Round. 15-Oct-89
- */
-
- #include "sMOVIE.h"
-
- extern struct GfxBase *GfxBase;
- extern struct IntuitionBase *IntuitionBase;
- extern struct DosLibrary *DosBase;
- extern struct Library *DiskfontBase;
- extern struct TextFont *tf[MAXFONTS+1], *font, *defaultfont;
- extern struct View v;
- extern struct ViewPort vp;
- extern struct BitMap b;
- extern struct Window *window;
- extern char *txstart;
- extern int fonts,textsiz,cmdsiz,bitmapheight,maxwidth,maxdepth;
- extern short *cmdstart;
- extern BPTR _Backstdout;
-
- void free_memory(level)
-
- int level; /* indicates what to try and free */
-
- {
- int i;
-
- switch (level) {
- case 10:
- for(i=0; i<maxdepth; i++)
- FreeRaster(b.Planes[i],maxwidth,bitmapheight);
- case 9:
- FreeColorMap(vp.ColorMap);
- case 8:
- FreeVPortCopLists(&vp);
- FreeCprList(v.LOFCprList);
- FreeCprList(v.SHFCprList);
- case 7:
- cmdsiz = rlsmem((char *)cmdstart,cmdsiz * sizeof(short));
- case 6:
- textsiz = rlsmem(txstart,textsiz);
- case 5:
- if (fonts) {
- for (i=fonts-1; i>=0; i--)
- if (tf[i])
- CloseFont(tf[i]);
-
- CloseLibrary((struct Library *)DiskfontBase);
- }
- case 4:
- CloseFont(defaultfont);
- case 3:
- if (window) CloseWindow(window);
- CloseLibrary((struct Library *)GfxBase);
- case 2:
- CloseLibrary((struct Library *)DosBase);
- case 1:
- CloseLibrary((struct Library *)IntuitionBase);
-
- break;
-
- } /* switch */
-
- if (_Backstdout) Close(_Backstdout);
-
- } /* end of free_memory */
-
- void off_sprite() { /* kludge 'cos OFF_SPRITE won't work for me */
-
- unsigned short *addr;
-
- addr = (unsigned short *) 0x0dff096;
- *addr = 0x0020;
- }
-
- void on_sprite() { /* kludge 'cos ON_SPRITE won't work for me */
-
- unsigned short *addr;
-
- addr = (unsigned short *) 0x0dff096;
- *addr = 0x8020;
- }
-